package pl.mdziedzic.unittest;

import static junit.framework.Assert.*;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;


public class JunitUsageExample {
	
	private List<String> collection;  
	
	@BeforeClass
	public static void ineTimeSetUp(){
		System.out.println("@BeforeClass - one time setup");
	}
	
	@AfterClass
	public static void oneTimeTearDown(){
		System.out.println("@AfterClass - one time tear down");
	}
	
	@Before
	public void setUp(){
		collection = new ArrayList<String>();  
		System.out.println("@Before - every method");
	}
	@After
	public void tearDown(){
		System.out.println("@After - cos na konsole");
		collection.clear();
	}
	
	@Test
	public void testEmptyCollection() {
		System.out.println("@Test  - empty collection");
		
		
		assertEquals(true,collection.isEmpty());
		assertTrue(collection.isEmpty());
	}
	
	@Test
	public void testCollectionContainsOneItem(){
		
		collection.add("Junit - string added to collection");
		assertEquals(1, collection.size());
		System.out.println("@Test  - If collection has one Item");
		
	}
}
